/*
2021-7-13
https://ac.nowcoder.com/acm/contest/17942/F
*/
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
typedef long long ll;

int n;

ll c(ll a,ll b)
{
    ll res=1;
    for(int i=a,j=1;j<=b;i--,j++)
    {
        res=res*i/j;
        if(res>n) return res;
    }
    return res;
}

bool check(int k)
{
    ll l=2*k,r=max(l,(ll)n);
    while(l<r)
    {
        int mid=(l+r)>>1;
        if(c(mid,k)>=n) r=mid;
        else l=mid+1;
    }
    if(c(r,k)!=n) return false;
    cout<<(1ll)*(r+1)*r/2+k+1<<endl;
    return true;
}

int main()
{
    scanf("%d",&n);
    
    for(int i=16;i>=0;i--)
    {
        if(check(i))
            break;
    }
    
    return 0;
}
